import { http } from '@/utils/request'

/**
 * 分享游记
 * @param {string} travelId - 游记ID
 * @returns {Promise} 返回分享结果，包含分享码
 */
export const shareTravel = (travelId) => {
  return http.post(`/api/share/travel/${travelId}`)
}

/**
 * 取消分享游记
 * @param {string} travelId - 游记ID
 * @returns {Promise} 返回取消分享结果
 */
export const cancelShareTravel = (travelId) => {
  return http.delete(`/api/share/travel/${travelId}`)
}

/**
 * 通过分享码获取游记
 * @param {string} shareCode - 分享码
 * @returns {Promise} 返回游记信息
 */
export const getTravelByShareCode = (shareCode) => {
  return http.get(`/api/share/travel/code/${shareCode}`)
}

/**
 * 分享行程计划
 * @param {string} planId - 行程计划ID
 * @returns {Promise} 返回分享结果，包含分享码
 */
export const sharePlan = (planId) => {
  return http.post(`/api/share/plan/${planId}`)
}

/**
 * 取消分享行程计划
 * @param {string} planId - 行程计划ID
 * @returns {Promise} 返回取消分享结果
 */
export const cancelSharePlan = (planId) => {
  return http.delete(`/api/share/plan/${planId}`)
}

/**
 * 通过分享码获取行程计划
 * @param {string} shareCode - 分享码
 * @returns {Promise} 返回行程计划信息
 */
export const getPlanByShareCode = (shareCode) => {
  return http.get(`/api/share/plan/code/${shareCode}`)
} 